<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>弓友之家</title>
    <link rel="stylesheet" href="css/mui.css" />
    <link rel="stylesheet" href="fonts/iconfont.css" />
    <link rel="stylesheet" href="css/style.css" />
    <style>
    	.null{padding-top: 20%;}
    	.null img{width: 70%;}
    </style>
</head>
<body>
	<header class="mui-bar mui-bar-nav">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		<h1 class="mui-title">搜索结果</h1>
		<!--<a class="mui-action-back mui-icon mui-icon-more-filled mui-pull-right"></a>-->
	</header>
	<div class="mui-content" style="padding-top: 54px;">
		<div class="index-goods">
			<div class="content">
				
			</div>
		</div>
		<div class="searchmember-content">
				
		</div>
		<div class="experience-content con1">
		        	
		</div>
		<div class="experience-content con2">
		        	
		</div>
		<div class="null mui-hidden mui-text-center"><img src="images/none.png"/></div>
	</div>
	<script type="text/javascript" src="js/mui.min.js" ></script>
	<script type="text/javascript" src="js/jquery-1.8.3.min.js" ></script>
	<script type="text/javascript" src="js/common.js" ></script>
	<script type="text/javascript" charset="utf-8">
      	mui.plusReady(function(){
      		var _self=plus.webview.currentWebview();
      		var keys=_self.keys;
      		var type=_self.type;
      		mui.ajax(H_SRC+'/amier/index/search_',{
				data:{
					token:token,
					keys:keys,
					type:type
				},
				dataType:'json',//服务器返回json格式数据
				type:'post',//HTTP请求类型
				timeout:10000,//超时时间设置为10秒；
				success:function(data){ 
					var dataurl=data.data;
					if(data.code == 401)
					{
						mui.openWindow({
							url:'login.html',
							id:'login.html'
						})
					}else if(data.code == 1)  
					{
						if(dataurl.length>0){
							var html="";
							if(type==1){
								for(var i=0;i<dataurl.length;i++){
									html+='<div class="one" data-id="'+dataurl[i].id+'" data-taobao="'+dataurl[i].id+'"><a class="img"><img src="'+H_SRC+''+dataurl[i].img+'"/></a>';
									html+='<div class="text"><h4 class="mui-ellipsis"><a data-id="'+dataurl[i].id+'">'+dataurl[i].goodsName+'</a></h4>';
									if(dataurl[i].isShipping==1){
										var by="<i>包邮</i>";
									}else{
										var by=""
									}
									html+='<h5 class="mui-clearfix"><span>￥'+parseInt(dataurl[i].price)+'</span>'+by+'<button type="button">立即兑换</button></h5>';
									html+='</div></div>'; 
								}
								$(".index-goods .content").html(html);
								$(".index-goods").on("tap",".one",function(){
						      		var gid=$(this).attr("data-id");
									mui.openWindow({
										url:'goods-list-page.html',
										id:'goods-list-page.html',
										createNew:true,
										show: {
											autoShow: true,
											aniShow: 'slide-in-right',
											duration: 200,
										},
										extras:{
											gid:gid
										}
									});
						      	})
							}
							if(type==2){
								for(var i=0;i<dataurl.length;i++){
									html+='<div class="mui-text-center one"><a data-id="'+dataurl[i].id+'" class="mui-row">';
									html+='<div class="mui-col-xs-2">'+dataurl[i].number+'</div>';
									html+='<div class="mui-col-xs-3">'+dataurl[i].realName+'</div>';
									html+='<div class="mui-col-xs-4">'+dataurl[i].mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')+'</div>';
									if(dataurl[i].score==null){
										dataurl[i].score=0;
									}
									html+='<div class="mui-col-xs-3">'+dataurl[i].score+'</div>';
									html+='</a></div>';
								}
								$(".searchmember-content").html(html);
								$(".searchmember-content").on("tap","a",function(){ 
						      		var mid=$(this).attr("data-id");
						      		mui.openWindow({
										url:'integralrank-page.html',
										id:'integralrank-page.html',
										createNew:true,
										show: {
											autoShow: true,
											aniShow: 'slide-in-right',
											duration: 200
										},
										extras:{
											mid:mid
										}
									});
						      	})
							}
							if(type==3){
								for(var i=0;i<dataurl.length;i++){
									var html1="";
									if(dataurl[i].type_id!=6){
										html1+='<dl class="mui-clearfix"><a data-id="'+dataurl[i].id+'">';
					        			html1+='<dt><img src="'+H_SRC+''+dataurl[i].thumb+'"/></dt>';
					        			html1+='<dd><h4 class="mui-ellipsis-2"><span>帖子</span>'+dataurl[i].title+'</h4>';
					        			html1+='<p>'+dataurl[i].c_time+'</p></dd></a></dl>';
					        			$('.con1').append(html1);
									}else{
										html1+='<dl class="mui-clearfix"><a data-id="'+dataurl[i].id+'">';
					        			html1+='<dt><img src="'+H_SRC+''+dataurl[i].thumb+'"/></dt>';
					        			html1+='<dd><h4 class="mui-ellipsis-2">'+dataurl[i].title+'</h4>';
					        			html1+='<p>'+dataurl[i].c_time+'</p></dd></a></dl>';
					        			$('.con2').append(html1);
									}
								}
								$(".con1").on("tap","a",function(){
									var nid=$(this).attr("data-id");
									mui.openWindow({
										url:'experience-page.html',
										id:'experience-page.html',
										createNew:true,
										extras:{
											nid:nid
										},
										show: {
											autoShow: true,
											aniShow: 'slide-in-right',
											duration: 200
										}
									});
								})
								$(".con2").on("tap","a",function(){
									var nid=$(this).attr("data-id");
									mui.openWindow({
										url:'notice-page.html',
										id:'notice-page.html',
										createNew:true,
										extras:{
											nid:nid
										},
										show: {
											autoShow: true,
											aniShow: 'slide-in-right',
											duration: 200
										}
									});
								})
								
							}
						}else{
							$(".null").removeClass("mui-hidden");
						}
						
					}else{ 
						mui.toast(data.msg);
					}
				},
				error:function(xhr,type,errorThrown){
					alert(errorThrown) 
				}
			}) 
      	})
      	
    </script>
</body>
</html>